<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>账号修改 - Layui</title>
<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="/css/admin.css">
</head>
<body style="background-color:#F1F1F1">
<div class="layui-layout layui-layout-admin">
  <div class="layui-body">
      <div class="layui-form-item" style="width: 400px;margin-top: 50px">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
          <input type="text" name="username" lay-verify="required" value="<?php echo $str['username']?>" autocomplete="off" class="layui-input username ">
        </div>
      </div>
      <div class="layui-form-item" style="width: 400px">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
          <input type="text" name="password" lay-verify="required" value="<?php echo $str['password']?>" autocomplete="off" class="layui-input password">
        </div>
      </div>
      <input type="hidden" value="<?php echo $str['id']?>" class="thisid">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="">确认修改</button>          
      </div>
  </div>
  <div class="layui-footer">
    <!-- 底部固定区域 -->
  </div>

</body>
</html>

<script src="/layui/layui.js"></script>
<script src="/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
layui.use('layer', function(){
  var layer = layui.layer;

  $(function(){
  var index = parent.layer.getFrameIndex(window.name);

  $('.layui-btn').click(function(){

 var id = $('.thisid').val();
 var username = $('.username').val();
 var password = $('.password').val();
  if(username==""||password==""){
    alert('用户名和密码必填!');
  }else{
    $.ajax({
      url:"/admin/admin/dochange",
      type:'post',
      data:{'username':username,'password':password,'id':id},
      dataType:'json',
      success:function(d){
        if(d.code==20){  
          layer.msg(d.msg,{
            icon:1,
            time:1000},
            function(){
                parent.layer.close(index);
          });        
        }else{
          layer.msg(d.msg,{
            icon:2,
            time:1000,
            });
        }
      }
    })
    
  }


  })

})
})



</script>
<script>

layui.use('element', function(){
  var element = layui.element(); //导航的hover效果、二级菜单等功能，需要依赖element模块  
});


</script>

